Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ilps22qs sensor support to lps2xdf driver #79850

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

avisconti
Copy link
Collaborator

The ILPS22QS is an ultra-compact piezoresistive absolute pressure and temperature sensor from ST Microelectronics.
https://www.st.com/en/mems-and-sensors/ilps22qs.html

It is register compatible with lps2xdf, which already handles lps22df and lps28dfw, so we will use it to handle ilps22qs as well. During the implementation few issues/improvements have been found and fixed.

The new driver has been verified on STM steval_stwinbx1 board.

Move api_lps2xdf_handle_interrupt() API inside the CONFIG_LPS2XDF_TRIGGER
ifdef, because it should be defined only in that case.

Signed-off-by: Armando Visconti <[email protected]>
Add a generic lps2xdf_config_int() API to configure device interrupt
mode, and implement the specific routines for lps22df and lps28dfw.

Signed-off-by: Armando Visconti <[email protected]>
Change I2C into I3C as it is a typo.

Signed-off-by: Armando Visconti <[email protected]>
@avisconti avisconti added bug The issue is a bug, or the PR is fixing a bug Enhancement Changes/Updates/Additions to existing features area: Drivers area: Boards area: Sensors Sensors platform: STM32 ST Micro STM32 area: Devicetree Binding PR modifies or adds a Device Tree binding labels Oct 15, 2024
@avisconti avisconti self-assigned this Oct 15, 2024
@zephyrbot zephyrbot added the area: Samples Samples label Oct 15, 2024
The ILPS22QS is an ultra-compact piezoresistive absolute pressure sensor
which functions as a digital output barometer, supporting dual full-scale
up to user- selectable 4060 hPa. The device delivers ultra-low pressure
noise with very low power consumption and operates over an extended
temperature range from -40 °C to +105 °C.

(https://www.st.com/en/mems-and-sensors/ilps22qs.html)

Signed-off-by: Armando Visconti <[email protected]>
Add support to ILPS22QS barometer.

Signed-off-by: Armando Visconti <[email protected]>
Add ilps22qs data streaming.

Signed-off-by: Armando Visconti <[email protected]>
Copy link
Collaborator

@jonas-rem jonas-rem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just saw some minor points.

Tested the updated driver with a custom board that has the lps28dfw device. I tested interrupt mode and both scales (1260 hPA and 4060 hPA). Works well.

Saw some unchanged copyright notices from 2023, not sure if you want to update them.

status = "okay";
odr = <LPS2xDF_DT_ODR_10HZ>;
lpf = <LPS2xDF_DT_LP_FILTER_ODR_4>;
avg = <LPS2xDF_DT_AVG_128_SAMPLES>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add a value for fs, as the sensor supports dual full-scale.

lps28dfw defines

fs = <LPS28DFW_DT_FS_MODE_1_1260>;

@@ -6,6 +6,7 @@
* SPDX-License-Identifier: Apache-2.0
*
* Datasheet:
* https://www.st.com/resource/en/datasheet/ilps22qs.pdf
Copy link
Collaborator

@jonas-rem jonas-rem Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are adding a link to the datasheet in lps2xdf.c , but not in lps2xdf.h.

What do you think of removing the set of links from one of the files?

*/
static int ilps22qs_trigger_set(const struct device *dev,
const struct sensor_trigger *trig,
sensor_trigger_handler_t handler)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Drivers area: Samples Samples area: Sensors Sensors bug The issue is a bug, or the PR is fixing a bug Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants